package counts;

import com.sun.org.apache.xpath.internal.functions.FuncSubstring;

public class countest {
    public static void main(String[] args) {
        String str = "woaijavawozhenaijavawozhendeaijavawozhendehenaijavaxinbuxinwoaijavagun";
        char arr[] = str.toCharArray();
        int count = 0;
        for(int i = 0; i < str.length()-4; i++){
            String substr = str.substring(i,i+4);
            if(substr.equals("java")){
                count++;
            }
        }
        System.out.println("java一共出现了"+count+"次。");
    }
}
